package com.xuan.system.domain.question.es;


import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.time.LocalDateTime;

@Setter
@Getter
@Document(indexName = "idx_question")
public class QuestionES {

    @Id
    @Field(type = FieldType.Long)
    private Long questionId;

    /**
     * 题目名称
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    private String title;

    /**
     * 难度: 1-简单, 2-中等  3-困难
     */
    @Field(type = FieldType.Byte)
    private Integer difficulty;

    /**
     * 题目内容/描述
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    private String content;

    /**
     * 时间限制
     */
    @Field(type = FieldType.Long)
    private Integer timeLimit;

    /**
     * 空间限制
     */
    @Field(type = FieldType.Long)
    private Integer spaceLimit;

    /**
     * 题目用例
     */
    @Field(type = FieldType.Text)
    private String questionCase;

    /**
     * 默认代码块/用户提交代码
     */
    @Field(type = FieldType.Text)
    private String defaultCode;

    /**
     * 代码运行的 main 函数
     */
    @Field(type = FieldType.Text)
    private String mainFunc;

    /**
     *  创建时间
     */
    @Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second)
    private LocalDateTime createTime;
}
